package task

import (
	"micro-sim/pkg/config"
	ctx "micro-sim/pkg/task/context"
)

// Status 任务状态
type Status int

// CommandFlag 任务命令标志
type CommandFlag int

const (
	Running Status = iota
	Stopped
	Paused
)

const (
	Start CommandFlag = iota
	Stop
	Pause
	Continue
	Reset
)

type Task interface {
	// ExecCommand 执行命令
	ExecCommand(cmd Command) error
	// Status 获取任务状态
	Status() (Status, error)
	// SetCtxStore 设置任务上下文存储
	SetCtxStore(ctxStore ctx.CtxStore) error
}

type Command struct {
	Flag CommandFlag
}

type Node interface {
	Name() string
}

type RunTaskInstance struct {
	Name string
	ctx  ctx.RunTaskCtx
}

func (r *RunTaskInstance) ExecCommand(cmd Command) error {
	//TODO implement me
	panic("implement me")
}

func (r *RunTaskInstance) Status() (Status, error) {
	//TODO implement me
	panic("implement me")
}

func (r *RunTaskInstance) SetCtxStore(ctxStore ctx.CtxStore) error {
	//TODO implement me
	panic("implement me")
}

func NewTask(config config.Config, name string, dslStr []byte) (Task, error) {

	return &RunTaskInstance{Name: name}, nil
}
